import axios from "@/utils/index.js";

export function userRoleTargetList(userIds) {
  return axios.get("/sysRole/getType", { params: userIds });
}
export function usergetToolList() {
  return axios.get("/sysUser/list");
}

export function userRoleupdategetList(data) {
  return axios.get("/userRole/selectIdByUR", { params: data });
}
export function RoleupdategetList({ roleType, userId}) {
  console.log("请求参数:", { roleType, userId });
  const params = new URLSearchParams()
  params.append('roleType', roleType)
  params.append('userId', userId)
  return axios.post(
    "/userRole/updateByRT",
    params, // 确保请求体格式正确
    {
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded', // 确保请求头设置为 JSON 格式
      },
    }
  ).then((response) => {
    console.log("接口响应:", response);
    return response;
  }).catch((error) => {
    console.error("接口请求失败:", error.response?.data || error);
    throw error;
  });
}

